package com.secsbrain.deploy.client.iface;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.secsbrain.common.ResponseVo;
import com.secsbrain.deploy.client.model.BuildModelDto;
import com.secsbrain.deploy.client.model.DeployParam;

/**
 * 构建模型相关服务
 *
 * @author zhaoyi
 */
@FeignClient(value = "service-deploy")
public interface ModelService {
	
	/**
     * 功能描述: <br>
     * 创建构建任务
     *
     * @param  deployParam  构建参数
     * @return 构建ID
     */
    @RequestMapping(value = "/deployservice/createDeployJob", method = RequestMethod.POST)
    ResponseVo<?> createDeployJob(@RequestBody DeployParam deployParam);
    
    /**
     * 功能描述: <br>
     * 更新构建任务
     *
     * @param  deployParam  构建参数
     * @return 构建ID
     */
    @RequestMapping(value = "/deployservice/updateDeployJob", method = RequestMethod.PUT)
    ResponseVo<?> updateDeployJob(@RequestBody DeployParam deployParam);
    
    /**
     * 功能描述: <br>
     * 删除构建任务
     *
     * @param deployParam
     * @return
     */
    @RequestMapping(value = "/deployservice/deleteDeployJob", method = RequestMethod.DELETE)
    ResponseVo<?> deleteDeployJob(@RequestBody DeployParam deployParam);
	
    /**
     * 功能描述: <br>
     * 根据环境查询所有构建模型
     *
     * @return
     */
    @RequestMapping(value = "/deployservice/queryAllBuildModelByEnv", method = RequestMethod.GET)
    ResponseVo<List<BuildModelDto>> queryAllBuildModelByEnv(@RequestParam("env") String env);
    
    /**
     * 功能描述: <br>
     * 通过应用ID查询构建模型
     *
     * @param  appId   应用ID
     * @return 
     */
    @RequestMapping(value = "/deployservice/queryBuildModelByApp", method = RequestMethod.GET)
    ResponseVo<BuildModelDto> queryBuildModelByApp(@RequestParam("appId") Long appId, @RequestParam("env") String env);
    
    /**
     * 功能描述: <br>
     * 获取分支列表
     *
     * @param  appId   应用ID
     * @return 
     */
    @RequestMapping(value = "/deployservice/queryBranchList", method = RequestMethod.GET)
    ResponseVo<List<String>> queryBranchList(@RequestParam("appId") Long appId, @RequestParam("env") String env);
    
}
